//
//  BKXXSQHeaderView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/24.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "BKXXSQHeaderView.h"

@implementation BKXXSQHeaderView

- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = CONTENTBACKCOLOR;
    
    [self addSubview:self.leftLabel];
    [self addSubview:self.centerLabel];
    [self addSubview:self.rightLabel];
    
    [_leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@20);
        make.width.equalTo(@200);
        make.centerY.equalTo(self.mas_centerY);
        make.height.equalTo(@20);
    }];
    [_centerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.width.equalTo(@200);
        make.centerY.equalTo(self.mas_centerY);
        make.height.equalTo(@20);
    }];
    [_rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@0).offset(-20);
        make.width.equalTo(@200);
        make.centerY.equalTo(self.mas_centerY);
        make.height.equalTo(@20);
    }];
}
- (UILabel *)leftLabel{
    if (!_leftLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text  = @"日期:2019-04-13周四";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = TITLECOLOR;
        label.textAlignment = 0;
        label.attributedText = [PublickFunctionObject getPriceAttribute:label.text and:SELECTEDCOLOR andChangeBenginString:@":" andEndString:@"" andSize:14];
        _leftLabel = label;
    }
    return _leftLabel;
}
- (UILabel *)centerLabel{
    if (!_centerLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text  = @"教室:209";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = TITLECOLOR;
        label.textAlignment = 0;
        label.attributedText = [PublickFunctionObject getPriceAttribute:label.text and:SELECTEDCOLOR andChangeBenginString:@":" andEndString:@"" andSize:14];
        _centerLabel = label;
    }
    return _centerLabel;
}
- (UILabel *)rightLabel{
    if (!_rightLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text  = @"容纳人数:20";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = TITLECOLOR;
        label.textAlignment = 0;
        label.attributedText = [PublickFunctionObject getPriceAttribute:label.text and:SELECTEDCOLOR andChangeBenginString:@":" andEndString:@"" andSize:14];
        _rightLabel = label;
    }
    return _rightLabel;
}
- (void)drawRect:(CGRect)rect{
    UIBezierPath *path = [[UIBezierPath alloc]init];
    [path moveToPoint:CGPointMake(0, 0)];
    [path addLineToPoint:CGPointMake(self.frame.size.width, 0)];
    [path setLineWidth:1];
    [LINCOLOR setStroke];
    [path stroke];
    
    UIBezierPath *pathLeft = [[UIBezierPath alloc]init];
    [pathLeft moveToPoint:CGPointMake(0, 0)];
    [pathLeft addLineToPoint:CGPointMake(0, 40)];
    [pathLeft setLineWidth:1];
    [LINCOLOR setStroke];
    [pathLeft stroke];
    
    UIBezierPath *pathRight = [[UIBezierPath alloc]init];
    [pathRight moveToPoint:CGPointMake(self.frame.size.width, 0)];
    [pathRight addLineToPoint:CGPointMake(self.frame.size.width, 40)];
    [pathRight setLineWidth:1];
    [LINCOLOR setStroke];
    [pathRight stroke];
}
@end
